package exam.bak.kingsoft;

import java.util.*;

public class P2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.nextLine());
        int[] nums = Arrays.stream(scanner.nextLine().trim().split("\\s+")).mapToInt(Integer::parseInt).toArray();
        int total = solve(nums);
        if (total > 0) {
            System.out.println(total);
        } else {
            System.out.println("No solution!");
        }
    }

    private static int solve(int[] nums) {
        int len = nums.length;
        int total = 0;
        for (int i = 1; i <= len; i++) {
            int[] count = new int[]{0};
            bt(nums, 0, i, new ArrayList<>(), count, new HashMap<String, String>());
            total += count[0];
        }
        return total;
    }

    private static void bt(int[] nums, int begin, int total, List<Integer> idxList, int[] count, HashMap<String, String> map) {
        if (idxList.size() == total) {
            double sum = idxList.stream().mapToDouble(idx -> 1.0 / nums[idx]).sum();
            if (sum == 1) {
                Set<Integer> set = new HashSet<>();
                idxList.stream().forEach(idx -> set.add(nums[idx]));
                StringBuilder sb = new StringBuilder();
                set.stream().forEach(sb::append);
                if (!map.containsKey(sb.toString())) {
                    count[0] += 1;
                    map.put(sb.toString(), "");
                }
            }
        } else if (begin < nums.length) {
            for (int i = begin; i < nums.length; i++) {
                //选当前的
                idxList.add(i);
                bt(nums, i + 1, total, idxList, count, map);
                idxList.remove(idxList.size() - 1);
            }
        }
    }


}
